﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" EnableEventValidation="false" CodeBehind="NotShippedGoodsOrderList.aspx.cs" Inherits="Otgruzka.WebForms.NotShippedGoodsOrderList" %>
<%@ Register Assembly="SamApp.WebControls.SearchGridView" Namespace="SamApp.WebControls" TagPrefix="SearchGridView" %>
<%@ Register Assembly="SamApp.WebControls.NestableGridView" Namespace="SamApp.WebControls" TagPrefix="NestableGridView" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:UpdatePanel ID="NotShippedGoodsOrderListUpdatePanel" runat="server">
    <ContentTemplate>
        <div class="UpdatePanelContent">
            <NestableGridView:NestableGridView 
                    ID="gvMaster" runat="server" 
                    AutoGenerateColumns="False" 
                    ShowEmptyHeader="False"
                    onprerender="gvMaster_PreRender" 
                    CellPadding="4" 
                    ShowFooter="False"
                    AllowSorting="True" 
                    ShowAddButton="False"
                    onselectedindexchanged="gvMaster_SelectedIndexChanged" 
                    onpageindexchanged="gvMaster_PageIndexChanged" 
                    onrowcommand="gvMaster_RowCommand" 
                    onselectedindexchanging="gvMaster_SelectedIndexChanging" 
                    onrowdatabound="gvMaster_RowDataBound" 
                    Width="100%" Height="183px" 
                    ShowRowNumber="false" ShowTotalRows="false"
                    AllowPaging="False" PageSize="5"
                    GridLines="Both" BorderWidth="2"
                    ChildTableID="pnlChild">

                <FooterStyle ForeColor="#FFFFFF" BackColor="#AAAAAA" />
                <EditRowStyle BorderWidth="0pt" ForeColor="#000000" BorderStyle="Solid" BorderColor="#0000FF" BackColor="#FFFFE0" />
                <HeaderStyle Font-Bold="True" ForeColor="#FFFFFF" BackColor="#4b6c9e" />
                <%--<AlternatingRowStyle BorderWidth="0pt" ForeColor="#000000" BorderStyle="Solid" BorderColor="#CCCCCC" BackColor="#EEEEEE" />--%>
                <%--<SelectedRowStyle ForeColor="#000000" BorderColor="#0000EE" BorderWidth="1" BackColor="#FFFFE0" />--%>
                <RowStyle BackColor="#FFFFFF" ForeColor="#000000" />
                <PagerStyle BorderWidth="0pt" Font-Bold="True" Font-Size="1.2em" BorderColor="#0000FF" BorderStyle="Solid" ForeColor="#000000" BackColor="#AAAAAA" />
          
                <Columns>
                    <asp:TemplateField ShowHeader="False" HeaderText="раскрыть">
                        <HeaderStyle Width="80px" />
                        <ItemStyle HorizontalAlign="Center" />
                        <ItemTemplate>
                            <asp:ImageButton ID="imgButSel" runat="server" CausesValidation="False" CommandName="Select" ImageUrl="~/Images/noselect.gif" Text="Select" />
                        </ItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField>
                        <HeaderStyle Width="0px" />
                        <ItemStyle Width="0px" />
                        <ItemTemplate>
                            <asp:Panel runat="server" ID="pnlChild" Width="100%" Visible="true">
                                <table width="100%" border="1px">
                                    <tr>
                                        <td width="5%">&nbsp;</td>
                                        <td>
                                            <SearchGridView:SearchGridView 
                                                    ID="gvChild" runat="server" 
                                                    ShowEmptyHeader="False"
                                                    CellPadding="3" 
                                                    Width="100%" 
                                                    AllowPaging="False" PageSize="5" 
                                                    AutoGenerateColumns="False" 
                                                    AllowSorting="True" 
                                                    ShowFooter="False"
                                                    ShowAddButton="False" 
                                                    GridLines="Both" BorderWidth="2"
                                                    ShowRowNumber="false" ShowTotalRows="false"
                                                    onrowcommand="gvChild_RowCommand"
                                                    onrowdatabound="gvChild_RowDataBound">

                                            <FooterStyle ForeColor="#FFFFFF" BackColor="#AAAAAA" />
                                            <EditRowStyle BorderWidth="0pt" ForeColor="#000000" BorderStyle="Solid" BorderColor="#0000FF" BackColor="#FFFFE0" />
                                            <HeaderStyle Font-Bold="True" ForeColor="#FFFFFF" BackColor="#4b6c9e" />
                                            <%--<AlternatingRowStyle BorderWidth="0pt" ForeColor="#000000" BorderStyle="Solid" BorderColor="#CCCCCC" BackColor="#EEEEEE" />--%>
                                            <%--<SelectedRowStyle ForeColor="#000000" BorderColor="#0000EE" BorderWidth="1" BackColor="#FFFFE0" />--%>
                                            <RowStyle BackColor="#FFFFFF" ForeColor="#000000" />
                                            <PagerStyle BorderWidth="0pt" Font-Bold="True" Font-Size="1.2em" BorderColor="#0000FF" BorderStyle="Solid" ForeColor="#000000" BackColor="#AAAAAA" />

                                                <Columns>
                                                    <asp:TemplateField>
                                                        <HeaderStyle Width="60px" />
                                                        <HeaderTemplate>ID товара</HeaderTemplate>
                                                        <ItemStyle HorizontalAlign="Center" />
                                                        <ItemTemplate><%#DataBinder.Eval(Container.DataItem, "Specification.ProductId")%></ItemTemplate>
                                                    </asp:TemplateField>

                                                    <asp:TemplateField>
                                                        <HeaderStyle Width="300px" />
                                                        <HeaderTemplate>Наименование товара</HeaderTemplate>
                                                        <ItemStyle HorizontalAlign="Left" />
                                                        <ItemTemplate><%#DataBinder.Eval(Container.DataItem, "Specification.ProductName")%></ItemTemplate>
                                                    </asp:TemplateField>

                                                    <asp:TemplateField>
                                                        <HeaderStyle Width="80px" />
                                                        <HeaderTemplate>Артикул у поставщика</HeaderTemplate>
                                                        <ItemStyle HorizontalAlign="Center" />
                                                        <ItemTemplate><%#DataBinder.Eval(Container.DataItem, "Specification.SupplierArtikul")%></ItemTemplate>
                                                    </asp:TemplateField>

                                                    <asp:TemplateField>
                                                        <HeaderStyle Width="80px" />
                                                        <HeaderTemplate>Поставщик</HeaderTemplate>
                                                        <ItemStyle HorizontalAlign="Center" />
                                                        <ItemTemplate><%#DataBinder.Eval(Container.DataItem, "Specification.SupplierName")%></ItemTemplate>
                                                    </asp:TemplateField>

                                                    <asp:TemplateField>
                                                        <HeaderStyle Width="80px" />
                                                        <HeaderTemplate>Кол-во товара</HeaderTemplate>
                                                        <ItemStyle HorizontalAlign="Center" />
                                                        <ItemTemplate><%#DataBinder.Eval(Container.DataItem, "Specification.Count")%></ItemTemplate>
                                                    </asp:TemplateField>

                                                    <asp:TemplateField>
                                                        <HeaderStyle Width="80px" />
                                                        <HeaderTemplate>Сумма (с НДС)</HeaderTemplate>
                                                        <ItemStyle HorizontalAlign="Center" />
                                                        <ItemTemplate><%#DataBinder.Eval(Container.DataItem, "Specification.Summa", "{0:F2}")%></ItemTemplate>
                                                    </asp:TemplateField>
                                                </Columns>

                                            </SearchGridView:SearchGridView>
                                        </td>
                                    </tr>
                                </table>
                            </asp:Panel>
                        </ItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField>
                        <%--<HeaderStyle Width="80px" />--%>
                        <HeaderTemplate>ID заказа</HeaderTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                        <ItemTemplate><%#DataBinder.Eval(Container.DataItem, "Header.Id")%></ItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField>
                        <%--<HeaderStyle Width="120px" />--%>
                        <HeaderTemplate>Номер заказа</HeaderTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                        <ItemTemplate><%#DataBinder.Eval(Container.DataItem, "Header.Number")%></ItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField>
                        <%--<HeaderStyle Width="120px" />--%>
                        <HeaderTemplate>Дата заказа</HeaderTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                        <ItemTemplate><%#DataBinder.Eval(Container.DataItem, "Header.CreatedDate")%></ItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField>
                        <HeaderStyle Width="350px" />
                        <HeaderTemplate>Адрес</HeaderTemplate>
                        <ItemTemplate><%#DataBinder.Eval(Container.DataItem, "Header.Description")%></ItemTemplate>
                        <%--<ItemTemplate><%#(DataBinder.Eval(Container.DataItem, "Header.Description") != null && DataBinder.Eval(Container.DataItem, "Header.Description") != "") ? DataBinder.Eval(Container.DataItem, "Header.Description").ToString().Substring(19) : ""%></ItemTemplate>--%>
                        <%--<ItemTemplate><%#DataBinder.Eval(Container.DataItem, "Header.Description").ToString().Substring(19)%></ItemTemplate>--%>
                    </asp:TemplateField>

                    <asp:TemplateField>
                        <HeaderStyle Width="220px" />
                        <HeaderTemplate>ФИО</HeaderTemplate>
                        <ItemTemplate><%#DataBinder.Eval(Container.DataItem, "Header.ContactName")%></ItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField>
                        <%--<HeaderStyle Width="120px" />--%>
                        <HeaderTemplate>Статус<br />заказа</HeaderTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                        <ItemTemplate><%#DataBinder.Eval(Container.DataItem, "State.Name")%></ItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField>
                        <HeaderStyle Width="160px" />
                        <HeaderTemplate>Сумма заказа (с НДС)</HeaderTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                        <ItemTemplate><%#DataBinder.Eval(Container.DataItem, "Header.ItogoSumm", "{0:F2}")%></ItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField>
                        <HeaderStyle Width="100px" />
                        <HeaderTemplate></HeaderTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                        <ItemTemplate>
                            <asp:Button runat="server" Text="Создать накладную >>" ID="btnExpendBill" CommandArgument='<%#DataBinder.Eval(Container.DataItem, "Header.Id")%>' OnClick="btnExpendBill_Click" />
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>

                <EmptyDataTemplate>Нет заказов</EmptyDataTemplate>
            </NestableGridView:NestableGridView>
        </div>
    </ContentTemplate>
    </asp:UpdatePanel>
    <asp:UpdateProgress ID="progressBar" runat="server" AssociatedUpdatePanelID="NotShippedGoodsOrderListUpdatePanel">
        <ProgressTemplate>
            <div id="closebg">
                <div id="centered">
                    <asp:Image ID="ProgressImage" runat="server" ImageUrl="~/Images/ajax-loader.gif" style="vertical-align:middle; text-align:center;" AlternateText="Проверяются введенные данные" />
                </div>
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
</asp:Content>
